﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<RoleListItemViewModel>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <h2>
        Roles</h2>
    <table>
        <thead>
            <tr>
                <th>
                    Role name
                </th>
                <th>
                    Users
                </th>
            </tr>
        </thead>
        <tbody>
            <% foreach (RoleListItemViewModel role in Model)
               { %>
            <tr>
                <td>
                    <%= Html.ActionLink(
                            role.RoleName, 
                            "Details",
                            new { roleName = role.RoleName}) %>
                </td>
                <td>
                    <%= role.NumberOfUsers %>
                </td>
            </tr>
            <%} %>
        </tbody>
    </table>
    <div class="createItem">
        <h3>
            Create new role</h3>
        <% using (Html.BeginForm())
           { %>
        <table>
            <tr>
                <th>
                    Role name
                </th>
                <td>
                    <%= Html.TextBox("roleName") %>
                </td>
            </tr>
        </table>
        <input type="submit" value="Create role" />
        <%} %>
    </div>
</asp:Content>
